<template>
  <div>
    <el-table :data="tableData" stripe style="width: 100%" max-height="600">
      <el-table-column prop="orderBy" label="排序" width="60">
      </el-table-column>
      <el-table-column prop="name" label="名称" show-overflow-tooltip>
      </el-table-column>
      <el-table-column prop="status" label="状态" width="100">
        <template slot-scope="scope">
          <span v-show="scope.row.status == 0">展示</span>
          <span v-show="scope.row.status == 1">隐藏</span>
        </template>
      </el-table-column>
      <el-table-column prop="createTime" label="创建时间" width="180">
      </el-table-column>
      <el-table-column label="操作" width="180">
        <template slot-scope="{ row }">
          <el-button-group>
            <el-button
              type="primary"
              size="mini"
              @click="edit(row)"
              :disabled="$button('760') == false ? true : false"
              >编辑</el-button
            >
            <el-button
              type="danger"
              size="mini"
              @click="remove('', row)"
              :disabled="$button('761') == false ? true : false"
              >删除</el-button
            >
          </el-button-group>
        </template>
      </el-table-column>
      <div slot="empty" class="emptyBg">
        <el-empty :image-size="200"></el-empty>
      </div>
    </el-table>
    <Pagination
      v-show="parseInt(pageObj.count) > 0"
      :total="parseInt(pageObj.count)"
      @change="getList"
      :page.sync="listQuery.page"
      :limit.sync="listQuery.limit"
    />
  </div>
</template>
<script>
import { sysIdeologicalEducationQueryContentList } from '@/api/admin/system/sysIdeologicalEducation.js'
import { TreeDelete } from '../mixins/TreeDelete'
import Bus from '@/utils/bus.js'
export default {
  mixins: [TreeDelete],
  data() {
    return {
      listQuery: {
        page: 1,
        limit: 10,
        id: 1,
        auditStatus: 2,
      },
      tableData: [],
      pageObj: {},
    }
  },
  mounted() {
    this.getList()
    Bus.$on('refreshList_EducationContent', (v) => {
      if (v) {
        Object.assign(this.listQuery, v)
      }
      this.getList()
    })
  },
  beforeDestroy() {
    Bus.$off('refreshList_EducationContent')
  },
  methods: {
    getList() {
      sysIdeologicalEducationQueryContentList(this.listQuery).then((res) => {
        this.tableData = res.data.data[0].objectList
        this.pageObj = res.data.data[0]
      })
    },
    //编辑节点
    edit(data) {
      Bus.$emit('showAddDialog_TreeAdd', { type: 'edit', data })
    },
  },
}
</script>
<style scoped lang="scss">
</style>